  function createReader(cb) {
    return function(event) {
      const file = event.target.files[0];
      const fr = new FileReader();
      fr.onload = function() {
        var img = new Image();
        img.src = fr.result;

        var button = document.createElement("div");
        button.classList.add("delete");
        button.innerHTML = "X";

        var div = document.createElement("div");
        div.classList.add("img");
        // div.style.position = "relative";

        div.appendChild(img);
        div.appendChild(button);

        cb(div);
      }
      fr.readAsDataURL(file);
      // 服务器端发送添加图片请求
      let formdata = new FormData();
      formdata.append("myFile", event.target.files[0]);
      let albumName = document.querySelector(".selected").dataset.name;
      fetch(`/upload-pic/${albumName}`, {
          method: "post",
          // headers: {
          //   "Content-Type": "multipart/form-data"
          // },
          body: formdata
      }).then(res => {
        res.json().then(json => {
          console.log(json);
        }).catch(err => {
          console.log(err);
        });
      });

      event.target.value = "";
    }
  }
